﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Linq;
using System.Text;

namespace BasketStats.Core.Stats
{
    public class Statistics : IStatistics, INotifyPropertyChanged
    {
        public Statistics()
        {
            Shots = new ObservableCollection<Shot>();
            Shots.CollectionChanged += (o, e) => RaisePropertyChanged("Shots");
            
            Turnovers = new ObservableCollection<Turnover>();
            Turnovers.CollectionChanged += (o, e) => RaisePropertyChanged("Turnovers");
        }

        public ObservableCollection<Shot> Shots { get; private set; }
        public ObservableCollection<Turnover> Turnovers { get; private set; }

        private int m_offensiveRebounds;
        public int OffensiveRebounds 
        {
            get
            {
                return m_offensiveRebounds;
            }
            set
            {
                if (m_offensiveRebounds != value)
                {
                    m_offensiveRebounds = value;
                    RaisePropertyChanged("OffensiveRebounds");
                }
            }
        }

        private int m_defensiveRebounds;
        public int DefensiveRebounds 
        {
            get
            {
                return m_defensiveRebounds;
            }
            set
            {
                if (m_defensiveRebounds != value)
                {
                    m_defensiveRebounds = value;
                    RaisePropertyChanged("DefensiveRebounds");
                }
            }
        }

        public int FoulsA { get; set; }
        public int FoulsP { get; set; }
        public int Assist { get; set; }
        public int Stolen { get; set; }
        public int Blocks { get; set; }
        public int Lost { get; set; }
        public bool GameStarted { get; set; }


        private void RaisePropertyChanged(string propertyName)
        {
            if (PropertyChanged != null)
            {
                PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
            }
        }

        public event PropertyChangedEventHandler PropertyChanged;
    }
}
 